<?php 

$prm09kpi=$kpiData['prm09kpi'];
$countries=$kpiData['countries'];
//debug($prm09kpi);
$months=$kpiData['months']

?>
<h2><?php __('Average Leadtime of process PRM09_KPI')  ?> </h2>

<table class="formstatus">
    <thead>
        <tr>
            <th rowspan="2"><?php __('Leadtime');  ?></th>
            <?php foreach ($countries as $value):  ?>
                <th colspan="2"><?php __($value);  ?></th>
            <?php endforeach;  ?>
        </tr>
        <tr>
            <?php foreach ($countries as $value):  ?>
                <th ><?php __('Year N');  ?></th>
                <th ><?php __('Year N-1');  ?></th>
            <?php endforeach;  ?>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><?php __('Average Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N']['Average Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N-1']['Average Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
        <tr>
            <td><?php __('Highest Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N']['Highest Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N-1']['Highest Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
        <tr>
            <td><?php __('Lowest Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N']['Lowest Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val]['total']['N-1']['Lowest Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
    </tbody>
</table>
<h2  class="showNextDiv pointer"><?php __('Average Leadtime of process per month PRM09_KPI')  ?> </h2><div class="isHidden">
<?php foreach ($months as $monthKey => $monthVal):  ?>

<h3 class="showNextDiv pointer"><?php __($monthVal);  ?></h3>
<div class="isHidden">

<table class="formstatus">
    <thead>
        <tr>
            <th rowspan="2"><?php __('Leadtime');  ?></th>
            <?php foreach ($countries as $value):  ?>
                <th colspan="2"><?php __($value);  ?></th>
            <?php endforeach;  ?>
        </tr>
        <tr>
            <?php foreach ($countries as $value):  ?>
                <th style="max-width: 30px"><?php __('Year N');  ?></th>
                <th style="max-width: 30px"><?php __('Year N-1');  ?></th>
            <?php endforeach;  ?>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><?php __('Average Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N']['Average Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N-1']['Average Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
        <tr>
            <td><?php __('Highest Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N']['Highest Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N-1']['Highest Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
        <tr>
            <td><?php __('Lowest Leadtime');  ?></td>
            <?php foreach ($countries as $key => $val):  ?>            

                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N']['Lowest Leadtime'];  ?></td>
                    <td class="monthTd"><?php echo $prm09kpi[$val][$monthKey]['N-1']['Lowest Leadtime'];  ?></td>

            <?php endforeach;  ?>
        </tr>
    </tbody>
</table>
    </div>

<?php endforeach;  ?>
</div>